<div class="enter_price">
<?php
	$strSize = urldecode($this->arrParam['size_id']);
	$arrSizeId = @json_decode($strSize, true);
	
	$value = urldecode($this->arrParam['value']);
	$arrValue = @json_decode($value, true);
	
	if(!empty($this->slbSize)){
		$arrSize = array();
		foreach ($this->slbSize as $k => $v){
			$arrSize[$v['id']] = $v['name'];
		}
	}
	
	
	$linkPost	= $this->cmsUrl(array(
									'module' => 'admin',	
									'controller' => 'admin-products',	
									'action' => 'enter-color',
									'size_id' => $this->arrParam['size_id']	
									));
									
?>
	<h1>Choose color for each size</h1>
	<form name="frm-enter-stock" id="frm-enter-color" method="post" action="<?php echo $linkPost?>">
		<?php 
		if(!empty($arrSizeId)){
			foreach ($arrSizeId as $k => $v){
				$sizeName = Zendvn_Filter_Filter::filterContent($arrSize[$v], 'filter');
				$color	= $this->cmsSelect('color[' . $v . ']', $arrValue[$v],array('class'=>'width-200 bg-green2 floatLeft', 'multiple' => 'multiple'), $this->slbColor);
		?>
		<div class="lev">
			<label>Size <?php echo $sizeName?></label>
			<div class="frm_input">
				<?php echo $color?>
				<p class="frm_error"></p>
			</div>
			<div class="clr"></div>
		</div>
		<?php 
			}
		}
		?>
		
		<div class="lev">
			<label></label>
			<a href="#" class="btn-save">Save</a>
		</div>
		<div style="display: none" id="hidden_input"><?php echo $xhtml?></div>
	</form>
</div>

<script>
	$(document).ready(function(){
		$('.btn-save').click(function(){
			var options = { 
					dataType: "json", 
					success	: optionsEnt
				}; 
			$('#frm-enter-color').ajaxSubmit(options);
			return false;
		});
	})
	function optionsEnt(data){
		$('.frm_error').html('').hide();
		if(data.type == 'success'){
			$('#hidden_color').val(data.msg);
			$.fancybox.close();
		}else{	
			for(var x in data.msg){
				if(x == 'color'){
					for(var y in data.msg[x]){
						var id = $('select[name="color[' + y + '][]"]');
						loadError(id,data.msg[x][y]);
					}
				}
				
			}
		}
	}
</script>
	